package com.commonly.dateformatting;

import java.text.SimpleDateFormat;
import java.util.Date;

public class FormattingDay {
	public static void main(String[] args) {

		// create Date object
		Date date = new Date();

		// formatting day in d format like 1,2 etc
		String strDateFormat = "d";
		SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);

		System.out.println("Current day in d format : " + sdf.format(date));

		// formatting day in dd format like 01, 02 etc.
		strDateFormat = "dd";
		sdf = new SimpleDateFormat(strDateFormat);
		System.out.println("Current day in dd format : " + sdf.format(date));
	}
}
